home *** CD-ROM | disk | FTP | other *** search
/ Collection of Internet / Collection of Internet.iso / msdos / lynx / source / doslynx / src / tclockvi.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-25  |  848 b   |  34 lines

  1. //    Copyright (c) 1993, University of Kansas, All Rights Reserved
  2. //
  3. //    Class:        TClockView
  4. //    Include File:    TClockVi.H
  5. //    Purpose:    provide a clock view to the desktop
  6. //    Remarks/Portability/Dependencies/Restrictions:
  7. //    Revision History:
  8. //        12-13-93    created
  9. //        02-10-94    Split all members into seperate files.
  10. #include"tclockvi.h"
  11. #include<time.h>
  12. #include<string.h>
  13.  
  14. void TClockView::update()    {
  15. //    Purpose:    update the view if need be
  16. //    Arguments:    void
  17. //    Return Value:    void
  18. //    Remarks/Portability/Dependencies/Restrictions:
  19. //    Revision History:
  20. //        12-13-93    created
  21.  
  22.     time_t t_t = time(0);
  23.     char *cp_date = ctime(&t_t);
  24.  
  25.     //    extract the time.
  26.     cp_date[19] = '\0';
  27.     strcpy(PresTime, &cp_date[11]);
  28.  
  29.     //    only if the time has changed
  30.     if(strcmp(PastTime, PresTime))    {
  31.         drawView();
  32.         strcpy(PastTime, PresTime);
  33.     }
  34. }